package com.xhorse.lockplatform.comm.model;

import com.xhorse.lockplatform.comm.util.SqlFunc;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.codehaus.jackson.annotate.JsonIgnore;

import java.util.Date;

/**
 * 带id的抽象类
 *
 * @author Tom
 */
public abstract class BaseId {
    /**
     * ID
     */
    @JsonIgnore
    protected Integer id;
    /**
     * 创建时间
     */
    @JsonIgnore
    protected Date gmtCreate;
    /**
     * 修改时间
     */
    @JsonIgnore
    protected Date gmtModified;

    @JsonIgnore
    public SqlFunc getFn() {
        return SqlFunc.get();
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getGmtCreate() {
        return gmtCreate;
    }

    public void setGmtCreate(Date gmtCreate) {
        this.gmtCreate = gmtCreate;
    }

    public Date getGmtModified() {
        return gmtModified;
    }

    public void setGmtModified(Date gmtModified) {
        this.gmtModified = gmtModified;
    }

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
    }
}
